package com.hitplane.elements 
{
	import com.hitplane.attack.NormalBulletAttack;
	import com.hitplane.core.Fly;
	import com.hitplane.enume.DisplayType;
	import com.hitplane.interfaces.IAttack;
	
	/**
	 * @describe  	敌机
	 * @author  	rrDog
	 * @website 	http://blog.sina.com.cn/zihua2007
	 * @time		... 
	 */
	public class EnemyFly_A extends Fly
	{
		private const NORMAL_ATTACK:String="normal_attack";
		
		public function EnemyFly_A() 
		{
			setFlyState();
			setFlyAttack();
			type = DisplayType.TYPE_ENEMY;
			reInit();
		}
		//override ===============================================================
		override public function onTick():void 
		{
			attack(NORMAL_ATTACK);
		}
		override public function hasCollision():void{
			setState(flyHitState);
		}
		override public function reInit():void{
			super.reInit();
			timeGap = 1000;
			setState(flyNormalState);
		}
		//private===============================================================
		private function setFlyAttack():void
		{
			var normalAttack:IAttack = new NormalBulletAttack(this, NormalWhitBullet,1,1);
			normalAttack.attackType = DisplayType.TYPE_ENEMY;
			registerAttack(NORMAL_ATTACK, normalAttack);
		}
		
		private function setFlyState():void 
		{
			registerState(flyNormalState.stateType, new EnemyFly_A_Mc());
			registerState(flyHitState.stateType,new EnemyFly_A_Hit_mc());
		}
		
	}
	
}